/* AI分析模块样式 */

/* 主容器 */
.ai-analysis-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.ai-analysis-header {
    text-align: center;
    margin-bottom: 30px;
}

.ai-analysis-header h2 {
    color: var(--primary-color, #007AFF);
    margin-bottom: 10px;
    font-size: 28px;
    font-weight: 600;
}

.ai-description {
    color: var(--text-secondary, #666);
    font-size: 16px;
    margin: 0;
}

/* 标签页导航 */
.ai-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-color, #e0e0e0);
}

.ai-tab-btn {
    background: none;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary, #666);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    margin: 0 10px;
}

.ai-tab-btn:hover {
    color: var(--primary-color, #007AFF);
    background-color: var(--hover-background, #f5f5f5);
}

.ai-tab-btn.active {
    color: var(--primary-color, #007AFF);
    border-bottom-color: var(--primary-color, #007AFF);
    background-color: var(--active-background, #f0f8ff);
}

/* 标签页内容 */
.ai-tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.ai-tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 提示词设置区域 */
.prompt-section {
    background: var(--card-background, #fff);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color, #e0e0e0);
}

.prompt-section h3 {
    color: var(--text-primary, #333);
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: 600;
}

.prompt-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.prompt-textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 2px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s ease;
}

.prompt-textarea:focus {
    outline: none;
    border-color: var(--primary-color, #007AFF);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.prompt-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* 文件上传区域 */
.upload-section {
    background: var(--card-background, #fff);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color, #e0e0e0);
}

.upload-section h3 {
    color: var(--text-primary, #333);
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 600;
}

.upload-area {
    border: 2px dashed var(--border-color, #e0e0e0);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    background: var(--background-light, #fafafa);
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--primary-color, #007AFF);
    background: var(--primary-light, #f0f8ff);
}

.upload-area.drag-over {
    border-color: var(--primary-color, #007AFF);
    background: var(--primary-light, #f0f8ff);
    transform: scale(1.02);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.upload-icon {
    font-size: 48px;
    opacity: 0.6;
}

.upload-area p {
    margin: 0;
    color: var(--text-primary, #333);
    font-size: 16px;
    font-weight: 500;
}

.upload-hint {
    color: var(--text-secondary, #666) !important;
    font-size: 14px !important;
    font-weight: 400 !important;
}

.upload-btn {
    background: var(--primary-color, #007AFF);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-btn:hover {
    background: var(--primary-dark, #0056b3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

/* 文件信息显示 */
.file-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--success-light, #f0f9f0);
    border: 1px solid var(--success-color, #28a745);
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
}

.file-details {
    display: flex;
    gap: 20px;
    align-items: center;
}

.file-name {
    font-weight: 600;
    color: var(--text-primary, #333);
}

.file-size, .file-type {
    color: var(--text-secondary, #666);
    font-size: 14px;
}

/* 上传进度 */
.upload-progress {
    margin-top: 20px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--background-light, #f0f0f0);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color, #007AFF), var(--success-color, #28a745));
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    color: var(--text-secondary, #666);
    font-size: 14px;
    text-align: center;
    display: block;
}

/* 上传操作按钮 */
.upload-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

/* 分析结果区域 */
.analysis-results {
    background: var(--card-background, #fff);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color, #e0e0e0);
}

.analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

.analysis-header h3 {
    color: var(--text-primary, #333);
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.analysis-actions {
    display: flex;
    gap: 10px;
}

.analysis-report {
    line-height: 1.6;
}

.report-header {
    background: var(--background-light, #f8f9fa);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.file-summary h4 {
    color: var(--text-primary, #333);
    margin-bottom: 10px;
    font-size: 16px;
}

.file-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.file-meta span {
    color: var(--text-secondary, #666);
    font-size: 14px;
}

.analysis-meta {
    display: flex;
    gap: 20px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color, #e0e0e0);
}

.processing-time, .model-used {
    color: var(--text-secondary, #666);
    font-size: 14px;
}

.analysis-content-body {
    background: var(--card-background, #fff);
    border-radius: 8px;
    padding: 20px;
    border: 1px solid var(--border-color, #e0e0e0);
}

.analysis-content-body h4 {
    color: var(--text-primary, #333);
    margin-bottom: 15px;
    font-size: 18px;
}

.analysis-text {
    color: var(--text-primary, #333);
    line-height: 1.8;
    font-size: 15px;
}

/* 历史记录区域 */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.history-header h3 {
    color: var(--text-primary, #333);
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.history-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.search-input {
    padding: 8px 12px;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 6px;
    font-size: 14px;
    width: 200px;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color, #007AFF);
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 6px;
    font-size: 14px;
    background: white;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.history-item {
    background: var(--card-background, #fff);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.history-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.history-info {
    flex: 1;
}

.history-filename {
    font-weight: 600;
    color: var(--text-primary, #333);
    margin-bottom: 5px;
}

.history-meta {
    display: flex;
    gap: 15px;
    color: var(--text-secondary, #666);
    font-size: 13px;
}

.history-actions {
    display: flex;
    gap: 8px;
}

/* 分页控件 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    padding: 20px;
}

.page-btn {
    background: var(--primary-color, #007AFF);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.page-btn:hover:not(:disabled) {
    background: var(--primary-dark, #0056b3);
}

.page-btn:disabled {
    background: var(--border-color, #e0e0e0);
    color: var(--text-secondary, #666);
    cursor: not-allowed;
}

.page-info {
    color: var(--text-secondary, #666);
    font-size: 14px;
}

/* 设置页面 */
.ai-settings-container {
    max-width: 800px;
    margin: 0 auto;
}

.ai-settings-container h3 {
    color: var(--text-primary, #333);
    margin-bottom: 30px;
    font-size: 24px;
    font-weight: 600;
    text-align: center;
}

.settings-section {
    background: var(--card-background, #fff);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color, #e0e0e0);
}

.settings-section h4 {
    color: var(--text-primary, #333);
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: 600;
}

/* 连接状态 */
.connection-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border-color, #e0e0e0);
}

.status-dot.connected {
    background: var(--success-color, #28a745);
    box-shadow: 0 0 8px rgba(40, 167, 69, 0.3);
}

.status-dot.disconnected {
    background: var(--danger-color, #dc3545);
    box-shadow: 0 0 8px rgba(220, 53, 69, 0.3);
}

.status-dot.testing {
    background: var(--warning-color, #ffc107);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    color: var(--text-primary, #333);
    font-weight: 500;
}

/* 系统信息 */
.system-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light, #f0f0f0);
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-secondary, #666);
    font-weight: 500;
}

.info-value {
    color: var(--text-primary, #333);
}

/* 统计信息网格 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.stat-card {
    background: var(--background-light, #f8f9fa);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    border: 1px solid var(--border-color, #e0e0e0);
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color, #007AFF);
    margin-bottom: 5px;
}

.stat-label {
    color: var(--text-secondary, #666);
    font-size: 12px;
    font-weight: 500;
}

/* 按钮样式 */
.btn-primary {
    background: var(--primary-color, #007AFF);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: var(--primary-dark, #0056b3);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 122, 255, 0.3);
}

.btn-secondary {
    background: var(--background-light, #f8f9fa);
    color: var(--text-primary, #333);
    border: 1px solid var(--border-color, #e0e0e0);
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: var(--border-color, #e0e0e0);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger-color, #dc3545);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-danger:hover {
    background: var(--danger-dark, #c82333);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

/* 状态样式 */
.loading-placeholder, .empty-state, .error-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary, #666);
    font-style: italic;
}

.error-state {
    color: var(--danger-color, #dc3545);
}

/* 通知系统样式 */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.notification {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-left: 4px solid var(--primary-color, #007AFF);
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    max-width: 100%;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-success {
    border-left-color: var(--success-color, #28a745);
}

.notification-error {
    border-left-color: var(--danger-color, #dc3545);
}

.notification-warning {
    border-left-color: var(--warning-color, #ffc107);
}

.notification-info {
    border-left-color: var(--info-color, #17a2b8);
}

.notification-content {
    display: flex;
    align-items: center;
    padding: 15px;
    gap: 10px;
}

.notification-icon {
    font-size: 18px;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
}

.notification-success .notification-icon {
    color: var(--success-color, #28a745);
}

.notification-error .notification-icon {
    color: var(--danger-color, #dc3545);
}

.notification-warning .notification-icon {
    color: var(--warning-color, #ffc107);
}

.notification-info .notification-icon {
    color: var(--info-color, #17a2b8);
}

.notification-message {
    flex: 1;
    color: var(--text-primary, #333);
    font-size: 14px;
    line-height: 1.4;
}

.notification-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-secondary, #666);
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.notification-close:hover {
    background: var(--background-light, #f0f0f0);
    color: var(--text-primary, #333);
}

/* 加载状态样式 */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: inherit;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color, #e0e0e0);
    border-top: 4px solid var(--primary-color, #007AFF);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: var(--text-secondary, #666);
    font-size: 14px;
    font-weight: 500;
}

/* 表单验证错误样式 */
.form-error {
    color: var(--danger-color, #dc3545);
    font-size: 12px;
    margin-top: 5px;
    display: block;
}

.input-error {
    border-color: var(--danger-color, #dc3545) !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1) !important;
}

/* 重试按钮样式 */
.retry-btn {
    background: var(--warning-color, #ffc107);
    color: var(--text-primary, #333);
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.retry-btn:hover {
    background: var(--warning-dark, #e0a800);
    transform: translateY(-1px);
}

/* 连接状态指示器增强 */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--background-light, #f8f9fa);
    border-radius: 6px;
    border: 1px solid var(--border-color, #e0e0e0);
}

.status-indicator.connected {
    background: rgba(40, 167, 69, 0.1);
    border-color: var(--success-color, #28a745);
}

.status-indicator.disconnected {
    background: rgba(220, 53, 69, 0.1);
    border-color: var(--danger-color, #dc3545);
}

.status-indicator.testing {
    background: rgba(255, 193, 7, 0.1);
    border-color: var(--warning-color, #ffc107);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .ai-analysis-container {
        padding: 15px;
    }
    
    .ai-tabs {
        flex-direction: column;
        align-items: center;
    }
    
    .ai-tab-btn {
        margin: 5px 0;
        width: 200px;
        text-align: center;
    }
    
    .history-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .history-controls {
        justify-content: center;
    }
    
    .history-item {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .history-actions {
        justify-content: center;
    }
    
    .file-details {
        flex-direction: column;
        gap: 5px;
        align-items: flex-start;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .search-input {
        width: 100%;
    }
}